import Home from '../views/Home.vue'
import userCenter from "../views/userCenter.vue"
import BookList from '../views/bookLsist/bookList.vue'
import Logon from '../components/logon.vue'
import UserBookList from "../views/userBookList.vue"
import Top from "../views/top.vue"
import BorrwBook from '../views/bookLsist/borrwBook.vue';
import ReadList from '../views/bookLsist/readList.vue';
import Detalist from "../views/detalis.vue";
import UserInfo from "../views/userCenter/userInfo.vue";
import UserPawUp from '../views/userCenter/userPawUp.vue';
import UserUpdata from "../views/userCenter/userUpdata.vue"
const routes = [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/about',
      name: 'About',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    },
    {
      path: '/userCenter',
      name: 'userCenter',
      component: userCenter,
      meta:{//是否需要路由守卫没有这值就代表不需要，auth
          auth: true
      },
      redirect:"/userCenter/userInfo",
      children:[
        {
          path:"userInfo",
          name:"userInfo",
          component:UserInfo,
          meta:{
            auth:true
          }
        },
        {
          path:"userUpdata",
          name:"userUpdata",
          component:UserUpdata,
          meta:{
            auth:true
          }
        },
        {
          path:"userPawUp",
          name:"userPawUp",
          component:UserPawUp,
          meta:{
            auth:true
          }
        }
      ]
    },{
      path: '/userCenter/logon',
      name: 'logon',
      component: Logon,
    },{
      path:"/userBookList",
      name:"userBookList",
      component : UserBookList,
      meta:{
        auth:true
      },
      redirect:"/userBookList/bookList",
      children:[
        {
          path:'bookList',
          name:"bookList",
          component:BookList,
          meta:{
            auth:true
          }
        },
        {
          path:"borrwBook",
          name:"borrwBook",
          component:BorrwBook,
          meta:{
            auth:true
          }
        },
        {
          path:"readList",
          name:"readList",
          component:ReadList,
          meta:{
            auth:true
          }
        }
      ]
    },{
      path:"/top",
      name:"top",
      component:Top
    },
    {
      path:"/detalist",
      name:"detalist",
      component:Detalist
    }
  ]
  
export default routes